package com.waitingresult.bzzc.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.waitingresult.bzzc.entity.Category;
import com.waitingresult.bzzc.mapper.CategoryMapper;
import com.waitingresult.bzzc.qo.CategoryQo;
import com.waitingresult.bzzc.service.CategoryService;
import com.waitingresult.common.base.service.impl.AbstractBaseServiceImpl;
import org.springframework.stereotype.Service;

/**
 * All right reserved,Designed By WangShuai
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : CategoryServiceImpl
 * @Description :
 * @date : 2021/11/28 0:53
 */
@Service
public class CategoryServiceImpl extends AbstractBaseServiceImpl<CategoryMapper, Category, CategoryQo> implements CategoryService {

    @Override
    public LambdaQueryWrapper<Category> getLamdaQueryWrapper(CategoryQo qo) {
        return new LambdaQueryWrapper<Category>()
                .eq(ObjectUtil.isNotNull(qo.getId()), Category::getId, qo.getId())
                .eq(ObjectUtil.isNotNull(qo.getParentId()), Category::getParentId, qo.getParentId())
                .like(ObjectUtil.isNotNull(qo.getName()), Category::getName, qo.getName());

    }
}
